package e

type ResCode struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

var (
	Success = ResCode{Code: 200, Msg: "成功"}
	Cache   = ResCode{Code: 200, Msg: "缓存数据"}
	Panic   = ResCode{Code: 500, Msg: "服务器异常"}
)

// Base
// ^100.{3,} 公共错误码
var (
	ParameterCheckFailed = ResCode{Code: 100001, Msg: "参数错误"}
	GatewayTimeOut       = ResCode{Code: 100002, Msg: "网关超时"}
	RequestsTooMany      = ResCode{Code: 100003, Msg: "请求频繁，请稍后再试"}
	RequestIllegalAccess = ResCode{Code: 100004, Msg: "非法请求"}
	ServerFailed         = ResCode{Code: 100005, Msg: "服务器异常"}
)

// User
// ^1010.{3,} 用户错误码
var (
	LoginTooMany       = ResCode{Code: 1010001, Msg: "登录次数太多，请稍后再试"}
	LoginKickOut       = ResCode{Code: 10100011, Msg: "登录被踢出，请重新登录"}
	LoginOverdue       = ResCode{Code: 10100012, Msg: "登录过期，请重新登录"}
	LoginIllegal       = ResCode{Code: 10100013, Msg: "登录非法"}
	NotAllow           = ResCode{Code: 10100014, Msg: "没有权限"}
	UserNotFound       = ResCode{Code: 1010002, Msg: "用户未找到"}
	UsernameRepeat     = ResCode{Code: 1010003, Msg: "用户名重复"}
	PhoneOrEmailRepect = ResCode{Code: 1010006, Msg: "手机号或者邮箱重复"}
	UserIsDisable      = ResCode{Code: 1010004, Msg: "用户被禁用"}
	PasswordFailed     = ResCode{Code: 1010005, Msg: "密码错误"}
	PhoneOrEmailRepeat = ResCode{Code: 1010006, Msg: "手机号或者邮箱重复"}
	CaptchaFailed      = ResCode{Code: 1010007, Msg: "验证码错误"}
	CaptchaExpired     = ResCode{Code: 1010008, Msg: "验证码已过期"}
)

// Resource
// ^1020.{3,} 资源错误码
var (
	ResourceNotFoundError = ResCode{Code: 1020001, Msg: "资源未找到"}
	ResourceRepeatError   = ResCode{Code: 1020002, Msg: "资源重复"}
	ResourceDisabled      = ResCode{Code: 1020003, Msg: "资源已禁用"}
)

// SMS
// ^1030.{3,} 短信错误码
var (
	SmsCheckError      = ResCode{Code: 1030001, Msg: "短信验证码校验失败"}
	MailCheckError     = ResCode{Code: 1030002, Msg: "邮箱验证码校验失败"}
	SmsSendError       = ResCode{Code: 1030003, Msg: "验证码发送失败"}
	SmsSendTooFrequent = ResCode{Code: 1030004, Msg: "验证码发送次数太多，请稍后再试"}
)

// Role
// ^1040.{4,} 角色
var (
	RoleNameRepeat = ResCode{
		Code: 1040001,
		Msg:  "角色名重复",
	}

	RoleNotFound = ResCode{
		Code: 1040002,
		Msg:  "角色不存在",
	}
)
